gh-139821: Make tarfile.open correctly forward keyword arguments for zstd in stream mode.#139822
gh-139821: Make tarfile.open correctly forward keyword arguments for zstd in stream mode.#139822beavailable wants to merge 6 commits intopython:mainfrom
tarfile.open correctly forward keyword arguments for zstd in stream mode.#139822Conversation
tarfile.open correctly forward keyword arguments for zstd in stream mode.
Lib/tarfile.py
Outdated
| def __init__(self, name, mode, comptype, fileobj, bufsize, | ||
| compresslevel, preset): | ||
| compresslevel, preset, level, options, zstd_dict): |
There was a problem hiding this comment.
I think it would be cleaner at this point to take **kwargs in _Stream and pop items per-(de)compressor. Having stream take every possible argument doesn't seem like a great idea for readability purposes since many of the arguments will be unused. I believe because this was up in the air and also how to treat compressLevel vs level, we intentionally didn't include this in 3.14 before the beta cutoff.
There was a problem hiding this comment.
Oh, I see. Thanks for the explanation.
I'll rewrite it.
There was a problem hiding this comment.
The new revision looks a lot better, thank you! I would also suggest using .get so that if the keywords are not passed then we don't get key errors and instead use fallbacks.
|
Sorry this slipped off my radar! I'll try to take a look in the next few days. |
tarfile.open()does not forward keyword arguments to the underlying_Streamobject for zstd in stream mode #139821📚 Documentation preview 📚: https://cpython-previews--139822.org.readthedocs.build/